<template>
  <div class="success">
    <i class="iconfont-sys icon">&#xe617;</i>
    <template v-if="!isRenewal">
      <h1 class="title">购买成功</h1>
      <div class="res">
        <p>已提交申请，等待管理员审核。</p>
      </div>
    </template>

    <template v-else>
      <h1 class="title">续费成功</h1>
      <div class="res"></div>
    </template>

    <el-button type="primary" @click="goHome">返回首页</el-button>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useTemporaryStore } from '@/store/modules/temporary'
const useTemporaryData = useTemporaryStore()
const router = useRouter()
const route = useRoute()

const isRenewal = ref(false)

function goHome() {
  useTemporaryData.setDrivingSchoolInfo({})
  useTemporaryData.setPayOrder('')
  useTemporaryData.setChooseDrivingSchoolCombo({})
  router.push('/drivingSchoolConsole/schoolConsole')
}

onMounted(() => {
  if (route.query.isRenewal) {
    isRenewal.value = true
  }
})
</script>

<style lang="scss" scoped>
.success {
  box-sizing: border-box;
  padding: 15px 100px !important;
  text-align: center;

  .icon {
    display: block;
    font-size: 80px;
    color: #19be6b !important;
  }

  .title {
    margin-top: 20px;
    font-size: 30px;
    font-weight: 500;
    color: var(--art-text-gray-900) !important;
  }

  .res {
    margin-top: 20px;
    margin-bottom: 30px;
  }
}
</style>
